package cn.hsp.login.mapper;

import cn.hsp.login.bean.SysRole;
import cn.hsp.login.bean.SysUser;
import cn.hsp.login.bean.SysUserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AuthMapper {
    @Select("SELECT * FROM sys_role WHERE id = #{id}")
    SysRole findRoleById(Integer id);

    @Select("SELECT * FROM sys_user_role WHERE user_id = #{userId}")
    List<SysUserRole> findRoleByUserId(Integer userId);

    @Select("SELECT * FROM sys_user WHERE id = #{id}")
    SysUser selectById(Integer id);

    @Select("SELECT * FROM sys_user WHERE name = #{name}")
    SysUser findByUsername(String name);
}
